import request from '@/utils/request'

// 分页查询角色列表接口
export const FindPage = (pageNum, pageSize, keyword) => {
  return request({
    url: `/admin/system/role/page/${pageNum}/${pageSize}`,
    method: 'GET',
    // '人'
    params: { keyword }, //{keyword:keyword},
  })
}
//删除角色
export const DeleteRole = id => {
  return request({
    url: `/admin/system/role/${id}`,
    method: 'DELETE',
  })
}
//新增角色
export const SaveRole = data => {
  return request({
    url: `/admin/system/role/save`,
    method: 'POST',
    //请求体传参： 要保存的角色json对象
    data,
  })
}
//根据id查询角色
export const GetById = id => {
  return request({
    url: `/admin/system/role/${id}`,
    method: 'GET',
  })
}
//更新角色
export const UpdateRole = data => {
  return request({
    url: `/admin/system/role/update`,
    method: 'PUT',
    //请求体传参： 要保存的角色json对象
    data,
  })
}
//根据userid查询角色列表
export const FindAllRoleByUserId = userId => {
  return request({
    url: `/admin/system/role/findAllRole/${userId}`,
    method: 'GET',
  })
}
